//
//  ABButton.m
//  AmountBody
//
//  Created by Qiu Jishuai on 2018/1/11.
//  Copyright © 2018年 RCMTM. All rights reserved.
//

#import "ABButton.h"
@interface ABButton()

@end
@implementation ABButton

+ (instancetype)buttonWithStyle: (ABButtonStyle)style {
    ABButton *button = [[ABButton alloc] init]; //buttonWithType:UIButtonTypeSystem];
//    button.high
    button.style = style;
    return button;
}

- (void)setStyle:(ABButtonStyle)style {
    _style = style;
    switch (self.style) {
        case ABButtonStyleDefault: {
            [self setBackgroundImage:[UIImage imageWithColor:[UIColor blackColor]] forState:UIControlStateNormal];
            [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            break;
        }
        case ABButtonStyleFingerprint: {
            UIImage *image = [UIImage imageNamed:@"ytj_mianLiao"];
            [self setBackgroundImage:image forState:UIControlStateNormal];
            [self setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
            break;
        }
        case ABButtonStyleCustom:
            [self setBackgroundImage:nil forState:UIControlStateNormal];
            break;
    }
}

- (void)setHighlighted:(BOOL)highlighted {
//    [super setHighlighted:highlighted];
    [UIView animateWithDuration:0.15
                          delay:0
                        options:UIViewAnimationOptionCurveEaseInOut
                     animations:^{
                         self.alpha = highlighted ? 0.6 : 1;
                     } completion:nil];
}


//- (instancetype)initWithFrame:(CGRect)frame {
//    self = [super initWithFrame:frame];
//    if (self) {
//        [self setup];
//    }
//    return self;
//}
//
//- (instancetype)initWithCoder:(NSCoder *)coder {
//    self = [super initWithCoder:coder];
//    if (self) {
//        [self setup];
//    }
//    return self;
//}


@end
